package com.xbao.dao;

import com.xbao.model.LesCheck;
import com.xbao.model.req.LesCheckReq;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created by qingshengzheng on 18/8/27.
 */
@Mapper
public interface LesCheckMapper {
    @Insert("insert into les_check(sid,lid,comments) values (#{sid},{lid},#{comments})")
    public void addLesCheck(LesCheckReq checkReq);
    @Delete("delete * from les_check where id=#{id}")
    public void deleteLesCheck(Long id);
    @Select("select * from les_check where id=#{od}")
    public void detailLesCheck(Long id);
    @Select("select * from  les_check " +
            "<where>" +
            "<if text sid!=null && sid!=''> sid=#{sid}</if>" +
            "<if test=\"lid!=null and lessdate !=''\">lessdate=#{lessdate},</if>" +
            "<if test=\"comments!=null and comments !=''\">comments=#{comments},</if>" +
            "</where>")
    public List<LesCheck> queryLesChecks(LesCheckReq req);

}
